package bancosys.tec.security.impl.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import jmine.tec.persist.annotation.Alias;

import org.hibernate.annotations.Type;

import bancosys.tec.component.Documentation;
import bancosys.tec.persist.bussobj.PersistableBusinessObject;
import bancosys.tec.utils.date.Timestamp;

/**
 * Armazena os dados de acesso de um usuário.
 * 
 * @author piercio
 */
@Entity
@Table(name = "USER_ACCESS_DATA")
@Alias("USACDT")
@SequenceGenerator(name = "SEQ_USACDT", sequenceName = "SEQ_USACDT")
@Documentation("ARMAZENA OS DADOS DE ACESSO DE UM USUARIO.")
public class UserAccessData extends PersistableBusinessObject {

    private Long id;

    private String username;

    private String sessionId;

    private String clientName;

    private Timestamp loginTimestamp;

    private Timestamp logoutTimestamp;

    /**
     * @return o valor para o campo id
     */
    @Id
    @GeneratedValue(generator = "SEQ_USACDT", strategy = GenerationType.AUTO)
    @Column(name = "COD_USER_ACCESS_DATA", nullable = false)
    @Documentation("CODIGO DO DADO DE ACESSO DE USUARIO")
    public Long getId() {
        return this.id;
    }

    /**
     * @param id o valor para o campo id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return o valor para o campo username
     */
    @Column(name = "USERNAME", nullable = false)
    @Documentation("NOME DO USUARIO")
    public String getUsername() {
        return this.username;
    }

    /**
     * @param username o valor para o campo username
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return o valor para o campo sessionId
     */
    @Column(name = "SESSION_ID")
    @Documentation("IDENTIFICACAO DA SESSAO DE CONEXAO")
    public String getSessionId() {
        return this.sessionId;
    }

    /**
     * @param sessionId o valor para o campo sessionId
     */
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    /**
     * @return o valor para o campo clientId
     */
    @Column(name = "SEC_CLIENT", nullable = false)
    @Documentation("NOME DO SISTEMA CLIENTE DE SEGURANCA")
    public String getClientName() {
        return this.clientName;
    }

    /**
     * @param clientId o valor para o campo clientId
     */
    public void setClientName(String clientId) {
        this.clientName = clientId;
    }

    /**
     * @return o valor para o campo loginTS
     */
    @Column(name = "LOGIN_TIMESTAMP", nullable = false)
    @Type(type = "bancosys.tec.persist.hibernate.type.TimestampType")
    @Documentation("DATA/HORA DO LOGIN")
    public Timestamp getLoginTimestamp() {
        return this.loginTimestamp;
    }

    /**
     * @param loginTS o valor para o campo loginTS
     */
    public void setLoginTimestamp(Timestamp loginTS) {
        this.loginTimestamp = loginTS;
    }

    /**
     * @return o valor para o campo logoutTS
     */
    @Column(name = "LOGOUT_TIMESTAMP")
    @Type(type = "bancosys.tec.persist.hibernate.type.TimestampType")
    @Documentation("DATA/HORA DO LOGOUT")
    public Timestamp getLogoutTimestamp() {
        return this.logoutTimestamp;
    }

    /**
     * @param logoutTS o valor para o campo logoutTS
     */
    public void setLogoutTimestamp(Timestamp logoutTS) {
        this.logoutTimestamp = logoutTS;
    }
}
